package com.bmlstrategys
{
	import com.strategy.IBML;
	import com.utils.Utils;
	
	import flash.utils.ByteArray;
	
	public class CITEMInfo extends BMLBase implements IBML
	{
		public function CITEMInfo(data:ByteArray)
		{
			super(data);
		}
		
		public function bmlstrategyxml():XML
		{
			var num:int = Utils.readHead(bmlData);
			var index:int=0;
			var xmlData:XML = new XML();
			xmlData = <root/>;
			
			while(index<num)
			{
				xmlData.appendChild(<items/>);
				xmlData.items[index].@templateID = bmlData.readUnsignedInt();
				xmlData.items[index].@mainClass = bmlData.readUnsignedInt();
				xmlData.items[index].@subClass = bmlData.readUnsignedInt();
				xmlData.items[index].@name = Utils.readString(bmlData);
				xmlData.items[index].@description =  Utils.readString(bmlData);
				xmlData.items[index].@attack = bmlData.readUnsignedInt();
				xmlData.items[index].@defence = bmlData.readUnsignedInt();
				xmlData.items[index].@normalHit = bmlData.readUnsignedInt();
				xmlData.items[index].@normalDodge = bmlData.readUnsignedInt();
				xmlData.items[index].@criticalDamage = bmlData.readUnsignedInt();
				xmlData.items[index].@criticalRate = bmlData.readUnsignedInt();
				xmlData.items[index].@skillHit = bmlData.readUnsignedInt();
				xmlData.items[index].@skillDodge = bmlData.readUnsignedInt();
				xmlData.items[index].@hpBonus = bmlData.readUnsignedInt();
				xmlData.items[index].@mpBonus = bmlData.readUnsignedInt();
				xmlData.items[index].@resistance1 = bmlData.readUnsignedInt();
				xmlData.items[index].@resistance2 = bmlData.readUnsignedInt();
				xmlData.items[index].@resistance3 = bmlData.readUnsignedInt();
				xmlData.items[index].@resistance4 = bmlData.readUnsignedInt();
				xmlData.items[index].@resistance5 = bmlData.readUnsignedInt();
				xmlData.items[index].@crtrateReduce = bmlData.readUnsignedInt();
				xmlData.items[index].@crtdmgReduce = bmlData.readUnsignedInt();
				xmlData.items[index].@damageReduce = bmlData.readUnsignedInt();
				xmlData.items[index].@minAttack = bmlData.readUnsignedInt();
				xmlData.items[index].@maxAttack = bmlData.readUnsignedInt();
				var j:uint=0;
				while (j < 3)
				{
					xmlData.items[index].@["AdditionFields"+j] = bmlData.readUnsignedInt();
					j++;
				}
				
				xmlData.items[index].@job = bmlData.readUnsignedInt();
				xmlData.items[index].@requiredLevel = bmlData.readUnsignedInt();
				xmlData.items[index].@sex = bmlData.readUnsignedInt();
				xmlData.items[index].@binding = bmlData.readUnsignedInt();
				xmlData.items[index].@flags = bmlData.readUnsignedInt();
				xmlData.items[index].@timeLimit = bmlData.readUnsignedInt();
				xmlData.items[index].@color = bmlData.readUnsignedInt();
				xmlData.items[index].@Set = bmlData.readUnsignedInt();
				xmlData.items[index].@setUnit = bmlData.readUnsignedInt();
				xmlData.items[index].@maxCount = bmlData.readUnsignedInt();
				xmlData.items[index].@priceOut = bmlData.readUnsignedInt();
				xmlData.items[index].@img = bmlData.readUnsignedInt();
				xmlData.items[index].@dropIconId = bmlData.readUnsignedInt();
				index++;
			}
			return xmlData;
		}
	}
}